package models.re;

import models.aaa.Asset;

public class AAAContext {
	
	private Long itemId = null;
	private String itemLid = null;
	private String type = null;
	private String text = null;
	private Asset user = null;
	
	public AAAContext() {
		
	}
	
	public AAAContext(Long itemId) {
		this.itemId=itemId;
	}
	
	public AAAContext(String itemLid) {
		this.itemLid=itemLid;
	}
	
	public AAAContext(String itemLid, String type) {
		this.itemLid = itemLid;
		this.type = type;
	}
	
	public AAAContext(String itemLid, Asset user) {
		this.itemLid=itemLid;
		this.user=user;
	}
	
	public Long getItemId() {
		if(itemId!=null) return itemId;
		else return Asset.find.byLid(itemLid).getId();
	}
	
	public Long getItemIdByUid() {
		if(itemId!=null) return itemId;
		else return Asset.find.byUid(itemLid).getId();
	}
	
	public Asset getItem() {
		if(itemLid==null) {
			return Asset.find.byId(itemId);
		}
		else {
			return Asset.find.byLid(itemLid);
		}
	}
	
	public String getType() {
		return type;
	}
	
	public String getText() {
		return text;
	}
	
	public Asset getUser() {
		return this.user;
	}

}
